package gregorytersoff_controller;



import gregorytersoff_boundary.DecisionlinesGUI;
import gregorytersoff_model.Model;

import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;




/* This particular solution to how to use non-final ints in actionPerformed was discovered on a Java help forum, and i take no credit for the idea */

public class Easierpassing2 implements ActionListener{
	private DecisionlinesGUI gui;
	private Model model;
	private int whichbutton;
	/**
	 * An implementation of actionlistener used to pass along an int indicating which JTextField to check the text of, since this integer is
	 * obtained via a for() loop used when initializing each choice.
	 * @param which The location in the array of JTextFields to pass on to to the ChoiceNameController 
	 * @param g The DecisionlinesGUi to pass on to to the ChoiceNameController
	 * @param m The Model to pass on to to the ChoiceNameController
	 */
	public Easierpassing2 (int which, DecisionlinesGUI g, Model m)
	{
		//button = b;
		whichbutton = which;
		gui = g;
		model = m;
	}
	/**Runs the ChoiceNameController with inputs not accessible had the controller been called directly by an anonymous actionlistener
	 * 
	 */
	public void actionPerformed(ActionEvent e) {
		new ChoiceNameController(gui.getChoiceText()[whichbutton].getText(), gui, model).process();	
	}

	
	
	
	

}
